/**
 * 
 */
package com.keggview.application.datatypes;

import java.util.ArrayList;

import org.dom4j.Element;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.Resource;

/**
 * @author Pablo
 * 
 * 
 * The relation element specifies relationship between two proteins (gene
 * products) or two KOs (ortholog groups) or protein and compound, which is
 * indicated by an arrow or a line connecting two nodes in the KEGG pathways.
 * The relation element has a subelement named the subtype element. When the
 * name attribute value of the subtype element is a value with directionality
 * like "activation", the direction of the interaction is from entry1 to entry2.
 * The attributes of this element are as follows.
 */
public class Relation extends Base {

	/**
	 * The entry1 attirbute specifies the id attribute value of the first entry
	 * element.
	 * 
	 * the ID of node which takes part in this relation
	 */
	private Integer entry1;

	/**
	 * The entry2 attirbute specifies the id attribute value of the second entry
	 * element.
	 * 
	 * 
	 * the ID of node which takes part in this relation
	 */
	private Integer entry2;

	/**
	 * The type attribute specifies one of three types of relations, so-called
	 * the generalized protein interactions in KEGG, and additional PCrel for
	 * interaction between a protein and a chemical compound, and maplink for
	 * linkage between a protein and a map. The maplink relation is provided for
	 * interaction between a protein and another in the specified map.<br>
	 * 
	 * types:<br>
	 * 
	 * - ECRel : enzyme-enzyme relation, indicating two enzymes catalyzing successive reaction steps<br>
	 * 
	 * - PPrel : protein-protein interaction, such as binding and modification<br>
	 * 
	 * - GErel : gene expression interaction, indicating relation of transcription factor and target gene product<br>
	 * 
	 * - PCrel : protein-compound interaction<br>
	 * 
	 * - maplink : link to another map<br>
	 */
	private String type;

	
	public static String T_ECREL = "ECRel";
	public static String T_PPREL = "PPrel";
	public static String T_GEREL = "GErel";
	public static String T_PCREL = "PCrel";
	public static String MAPLINK = "maplink";

	@SuppressWarnings("unused")
	private ArrayList<Subtype> subtypes;
	@SuppressWarnings("unused")
	private Entry entry1object;
	@SuppressWarnings("unused")
	private Entry entry2object;
	
	/**
	 * @param entry1
	 * @param entry2
	 * @param type
	 */
	public Relation(Integer entry1, Integer entry2, String type) {
		this.entry1 = entry1;
		this.entry2 = entry2;
		this.type = type;
		this.subtypes = new ArrayList<Subtype>(0);
		this.entry1object = null;
		this.entry2object = null;
	}


	public Relation(Element element) {
		this.entry1 = Integer.valueOf(element.attribute("entry1").getValue());
		this.entry2 = Integer.valueOf(element.attribute("entry2").getValue());
		String tempType = element.attribute("type").getValue();

		if (tempType.equals(Relation.MAPLINK)) {
			this.type = Relation.MAPLINK;
		}
		if (tempType.equals(Relation.T_ECREL)) {
			this.type = Relation.T_ECREL;
		}
		if (tempType.equals(Relation.T_GEREL)) {
			this.type = Relation.T_GEREL;
		}
		if (tempType.equals(Relation.T_PCREL)) {
			this.type = Relation.T_PCREL;
		}
		if (tempType.equals(Relation.T_PPREL)) {
			this.type = Relation.T_PPREL;
		}
		
	}


	/**
	 * @return the entry1
	 */
	public Integer getEntry1() {
		return entry1;
	}


	/**
	 * @param entry1 the entry1 to set
	 */
	public void setEntry1(Integer entry1) {
		this.entry1 = entry1;
	}


	/**
	 * @return the entry2
	 */
	public Integer getEntry2() {
		return entry2;
	}


	/**
	 * @param entry2 the entry2 to set
	 */
	public void setEntry2(Integer entry2) {
		this.entry2 = entry2;
	}


	/**
	 * @return the type
	 */
	public String getType() {
		return type;
	}


	/**
	 * @param type the type to set
	 */
	public void setType(String type) {
		this.type = type;
	}


	@Override
	public TreeIterator<EObject> eAllContents() {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public EClass eClass() {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public EObject eContainer() {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public EStructuralFeature eContainingFeature() {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public EReference eContainmentFeature() {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public EList<EObject> eContents() {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public EList<EObject> eCrossReferences() {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public Object eGet(EStructuralFeature arg0) {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public Object eGet(EStructuralFeature arg0, boolean arg1) {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public boolean eIsProxy() {
		// TODO Auto-generated method stub
		return false;
	}


	@Override
	public boolean eIsSet(EStructuralFeature arg0) {
		// TODO Auto-generated method stub
		return false;
	}


	@Override
	public Resource eResource() {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public void eSet(EStructuralFeature arg0, Object arg1) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public void eUnset(EStructuralFeature arg0) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public EList<Adapter> eAdapters() {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public boolean eDeliver() {
		// TODO Auto-generated method stub
		return false;
	}


	@Override
	public void eNotify(Notification arg0) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public void eSetDeliver(boolean arg0) {
		// TODO Auto-generated method stub
		
	}
	
}
